using ABPLHQCS.Localization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;
using Volo.Abp.MultiTenancy;

namespace ABPLHQCS.Permissions;

public class ABPLHQCSPermissionDefinitionProvider : PermissionDefinitionProvider
{
    public override void Define(IPermissionDefinitionContext context)
    {
        var myGroup = context.AddGroup(ABPLHQCSPermissions.GroupName);

        //var booksPermission = myGroup.AddPermission(ABPLHQCSPermissions.Books.Default, L("Permission:Books"));
        //booksPermission.AddChild(ABPLHQCSPermissions.Books.Create, L("Permission:Books.Create"));
        //booksPermission.AddChild(ABPLHQCSPermissions.Books.Edit, L("Permission:Books.Edit"));
        //booksPermission.AddChild(ABPLHQCSPermissions.Books.Delete, L("Permission:Books.Delete"));
        //Define your own permissions here. Example:
        //myGroup.AddPermission(ABPLHQCSPermissions.MyPermission1, L("Permission:MyPermission1"));


        var formItemsPermission = myGroup.AddPermission(ABPLHQCSPermissions.FormItems.Default, L("Permission:FormItems"));
        formItemsPermission.AddChild(ABPLHQCSPermissions.FormItems.Create, L("Permission:FormItems.Create"));
        formItemsPermission.AddChild(ABPLHQCSPermissions.FormItems.Edit, L("Permission:FormItems.Edit"));
        formItemsPermission.AddChild(ABPLHQCSPermissions.FormItems.Delete, L("Permission:FormItems.Delete"));

        var formInstancesPermission = myGroup.AddPermission(ABPLHQCSPermissions.FormInstances.Default, L("Permission:FormInstances"));
        formInstancesPermission.AddChild(ABPLHQCSPermissions.FormInstances.Create, L("Permission:FormInstances.Create"));
        formInstancesPermission.AddChild(ABPLHQCSPermissions.FormInstances.Edit, L("Permission:FormInstances.Edit"));
        formInstancesPermission.AddChild(ABPLHQCSPermissions.FormInstances.Delete, L("Permission:FormInstances.Delete"));

        var departmentPermission = myGroup.AddPermission(ABPLHQCSPermissions.Departments.Default, L("Permission:Departments"));
        departmentPermission.AddChild(ABPLHQCSPermissions.Departments.Create,L("Permission:Departments.Create"));
        departmentPermission.AddChild(ABPLHQCSPermissions.Departments.Edit, L("Permission:Departments.Edit"));
        departmentPermission.AddChild(ABPLHQCSPermissions.Departments.Delete, L("Permission:Departments.Delete"));

        var formcategoryPermission = myGroup.AddPermission(ABPLHQCSPermissions.FormCategory.Default,L("Permission:FormCategory"));
        formcategoryPermission.AddChild(ABPLHQCSPermissions.FormCategory.Create, L("Permission:FormCategory.Create"));
        formcategoryPermission.AddChild(ABPLHQCSPermissions.FormCategory.Edit, L("Permission:FormCategory.Edit"));
        formcategoryPermission.AddChild(ABPLHQCSPermissions.FormCategory.Delete, L("Permission:FormCategory.Delete"));
    }

    private static LocalizableString L(string name)
    {
        return LocalizableString.Create<ABPLHQCSResource>(name);
    }
}
